package sun.nan.test.java;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;

/**
 * Created by linan on 2015/8/23.
 */
public class MoveFiles {
    public static void main(String[] args) throws IOException, InterruptedException {
        while (true) {
            File dir = new File("/alidata/test/");
            File[] files = dir.listFiles();
            for (File file : files) {
                if (file.isFile()) {
                    long filesize = file.length();
                    if (filesize > 200 * 1024 && filesize < 400 * 1024)
                        FileUtils.moveFile(file, new File("/mnt/" + file.getName()));
                }
            }
            Thread.sleep(2 * 3600 * 1000);
        }
    }
}
